//
//  main.swift
//  sorting
//
//  Created by lhc on 2023/7/28.
//

import Foundation

let sortNames: [SortName] = [.选择排序,
                             .插入排序,
                             .归并排序,
                             .自底向上归并排序,
                             .快速排序,
                             .三路快速排序,
                             .冒泡排序,
                             .希尔排序]

func test<E: Comparable>(sequence: [E], title: String) {
    var sequences: [[E]] = []
    for _ in sortNames.indices {
        sequences.append(sequence)
    }
    
    print("----------\(title)----------")
    
    for i in sortNames.indices {
        SortHelper.sortTest(sortName: sortNames[i], sequence: sequences[i])
    }
}



test(sequence: ArrayGenerator.generateSortedArray(n: 10000), title: "有序数组")
test(sequence: ArrayGenerator.generateRandomArray(n: 10000), title: "无序数组")
test(sequence: [Student(score: 79), Student(score: 88), Student(score: 80), Student(score: 77)], title: "无序Student类数组")



